package ws.jdbc.concurrent.driver.sqlserver.tds;

import java.util.ArrayList;

/**
 * Packet Data Stream Headers - ALL_HEADERS Rule Definition.
 *
 * <p>
 * <a href="http://msdn.microsoft.com/en-us/library/dd304953">Reference</a>
 * </p>
 *
 * @author Wilson Santos, 36228 <wilson.santos@ua.pt>
 */
public class ALL_HEADERS {

  public static final int QUERY_NOTIFICATIONS = 0x0001;
  public static final int TRANSACTION_DESCRIPTOR = 0x0002;
  /** Total length of ALL_HEADERS stream. */
  private int totalLenght;
  private ArrayList<Header> headerList = new ArrayList<Header>();

  class Header {

    /** Total length of an individual header. */
    private int headerLength;
    /** The type of header, as defined by the value field in the preceding table. */
    private short headerType;
    /**
     * The data stream for the header.
     * It might contain a "Query Notifications Header" or a "Transaction Descriptor Header".
     */
    private byte[] headerData;
  }

  class TransactionDescriptorHeader {

    private int outstandingRequestCount;
    private long transactionDescriptor;
  }

  class QueryNotificationsHeader {

    private short notifyId;
    //UNICODESTREAM ; user specified value
//                                            when subscribing to the
//                                            query notification
    private short SSBDeployment;
//        USHORT UNICODESTREAM ;
    private int NotifyTimeout;
//        =   ULONG                ; duration in which the query
//                                            notification subscription
//                                            is valid
  }
}
